<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="x5-orientation" content="portrait">
		<meta name="screen-orientation" content="portrait">
		<meta http-equiv="Cache-Control" content="no-cache">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
		<link rel="stylesheet" type="text/css" href="static/css/malifenqi.css" />
		<title>麻利分期</title>
	</head>

	<body oncopy="return false;">
		<div class="mask" style="display: none;"></div>
		<div class="content">
			<div class="banner">
				<img src="static/img/mali_banner.png?v=1" class="bgpic">
				<div>
					<img src="static/img/mali_logo.png?v=2" alt="" />
					<span>麻利分期</span>
				</div>
			</div>
			<div class="txtMarquee-top">
				<div class="bd">
					<div class="tempWrap" style="overflow:hidden; position:relative; height:18px">
						<ul class="infoList" style="height: 324px; position: relative; padding: 0px; margin: 0px; top: -108px;">
							<li class="clone">用户<span class="telephone">155****2951</span>成功借款1500元</li>
							<li>用户<span class="telephone">131****1291</span>成功借款3000元</li>
							<li>用户<span class="telephone">182****1315</span>成功借款2000元</li>
							<li>用户<span class="telephone">185****0651</span>成功借款1000元</li>
							<li>用户<span class="telephone">177****4180</span>成功借款3000元</li>
							<li>用户<span class="telephone">132****1981</span>成功借款2500元</li>
							<li class="clone">用户<span class="telephone">131****2365</span>成功借款1500元</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="enteraera">
				<input type="tel" placeholder="请输入您的手机号码" class="text1" maxlength="11">
				<input type="button" value="立即借款" class="enter1">
				<div class="hint1" style="visibility: hidden;color: white;"></div>
				<div class="div">
					<span>点击按钮视为同意 <b onclick="window.location.href='register.html?alias='+alias">《服务协议》</b></span>
				</div>
			</div>
			<div style="width: 100%;height: 60px;"></div>
		</div>
		<div class="newpop" style="display: none;">
			<div class="pop2" style="display: none;">
				<p class="phone">手机号码：<span class="phonenumber"></span></p>
				<div class="figure">
					<input type="text" id="txtimgcode" placeholder="请输入图形验证码" class="text2" onkeyup="this.value=this.value.replace(/[^\w\.\/]/ig,&#39;&#39;)" onblur="this.value=this.value.replace(/[^\w\.\/]/ig,&#39;&#39;)">
					<span class="enter2"><img id="imgcode" src="" onclick="changeGraphCode()"></span>
				</div>
				<div class="message">
					<input type="text" id="Code" placeholder="请输入短信验证码" class="text3" maxlength="6" onkeyup="this.value=this.value.replace(/[^\d]/g,&#39;&#39;)" onblur="this.value=this.value.replace(/[^\d]/g,&#39;&#39;)">
					<span class="enter3">获取验证码</span>
					<input type="password" placeholder="请设置登录密码" class="password" />
				</div>
				<div class="hint2" style="visibility: hidden;"></div>
				<input type="button" class="ensure2" value="确认">
				<div class="close">
					<img src="static/img/close.png" class="closebtn">
				</div>
			</div>
			<div class="pop3" style="display: none;">
				<p class="knows"></p>
				<input type="button" class="ensure3" value="下载登录">
				<div class="close">
					<img src="static/img/close.png" class="closebtn">
				</div>
			</div>
		</div>
	</body>
	<script src="static/js/overall.js"></script>
	<script src="static/js/jquery-2.1.4.min.js"></script>
	<script src="static/js/jquery.SuperSlide.2.1.1.js"></script>
	<script src="static/js/Zdownload.js"></script>
	<script src="https://s19.cnzz.com/z_stat.php?id=1275767378&web_id=1275767378" language="JavaScript"></script>
	<script>
		var _czc = _czc || [];
		_czc.push(["_setAccount", "1275767378"]);

		function push(alias, action, clientType, origin) {
			try {
				_czc.push(﻿["_trackEvent", clientType + "-" + origin, action]);
			} catch(e) {
				//TODO handle the exception
			}
		};
	</script>
	<script type="text/javascript">
		var path = window.location.pathname;
		var start = path.lastIndexOf("\/");
		var end = path.lastIndexOf(".");
		var alias = path.substring(start + 1, end);
		var clientType = getClientType();
		var domain = apiDomain();
		var old_phone = "";
		var uuid = "";

		var origin_id = GetQueryString("origin");
		origin_id = origin_id ? origin_id : clientType;
		push(alias, "打开", clientType, origin_id);
		$(".mask,.newpop").hide();

		//点击借款
		$(".enter1").click(function() {
			var telephone = $(".text1").val();
			var reg1 = /^0?1[3-9][0-9]\d{8}$/;
			if(telephone == "") {
				$(".hint1").css("visibility", "visible");
				$(".hint1").html("手机号不能为空");
				return false;
			} else if(!reg1.test(telephone)) {
				$(".hint1").css("visibility", "visible");
				$(".hint1").html("手机号错误");
				return false;
			} else {
				$(".mask,.newpop,.pop2").show();
				$(".pop3").hide();
				$(".phonenumber").text($(".text1").val());
				if($(".text1").val() != old_phone) {
					changeGraphCode();
					window.clearInterval(InterValObj); //停止计时器
					$(".enter3").removeAttr("disabled"); //启用按钮
					$(".enter3").text("获取验证码");
					$(".enter3").css({
						"background": "#FFF158"
					});
				}
			}
		});

		//验证码倒计时
		var InterValObj;

		function countdown() {
			$(".enter3").attr("disabled", "true");
			$(".enter3").css({
				"background": "#DDDDDD"
			});
			//timer变量，控制时间
			var count = 59; //间隔函数，1秒执行
			var curCount; //当前剩余秒数
			sendMessage();

			function sendMessage() {
				curCount = count;
				//设置效果，开始计时
				$(".enter3").text(curCount + "s");
				InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
			};
			//timer处理函数
			function SetRemainTime() {
				if(curCount == 0) {
					window.clearInterval(InterValObj); //停止计时器
					$(".enter3").removeAttr("disabled"); //启用按钮
					$(".enter3").text("获取验证码");
					$(".enter3").css({
						"background": "#FFF158"
					});
				} else {
					$(".enter3").attr({
						"disabled": "disabled"
					});
					curCount--;
					$(".enter3").text(curCount + "s");
				}
			}
		};

		//点击获取验证码
		$(".enter3").click(function() {
			push(alias, "验证码", clientType, origin_id);
			if($(".enter3").text() == "获取验证码") {
				$.ajax({
					type: "post",
					url: domain + "web/mobile_code",
					dataType: "json",
					data: {
						alias: alias,
						phone: $(".phonenumber").text(),
						graph_code: $(".text2").val(),
						uuid: uuid
					},
					success: function(data) {
						if(data.status == 2000) {
							window.clearInterval(InterValObj);
							countdown();
						} else if(data.status == 2001) {
							$(".knows").text("您的手机已注册过，请前往APP登录")
							$(".mask,.newpop").hide();
							$(".mask,.newpop,.pop3").show();
							$(".pop2").hide();
						} else {
							$(".hint2").css("visibility", "visible");
							$(".hint2").html(data.message);
							changeGraphCode();
						}
					}
				});
			};
		});

		//注册
		$(".ensure2").click(function() {
			var messagecode = $(".text3").val();
			var password = $(".password").val();
			if(messagecode == "") {
				$(".hint2").css("visibility", "visible");
				$(".hint2").html("短信验证码不能为空");
				return false;
			} else if(password == "") {
				$(".hint2").css("visibility", "visible");
				$(".hint2").html("密码不能为空");
			} else {
				$.ajax({
					type: "POST",
					url: domain + "web/register",
					data: {
						alias: alias,
						phone: $(".phonenumber").text(),
						password: password,
						phone_code: messagecode,
						origin_id: origin_id
					},
					dataType: "json",
					beforeSend: function() {
						$(".ensure2").attr("disabled", true);
						$(".ensure2").css("background-color", "#8d9594");
					},
					success: function(result) {
						$(".ensure2").attr("disabled", false);
						$(".ensure2").css("background-color", "#ff8f2b");
						if(result.status == 2000) {
							push(alias, "注册", clientType, origin_id);
							$(".knows").text("恭喜您注册成功，请前往APP登录")
							$(".mask,.newpop").hide();
							$(".mask,.newpop,.pop3").show();
							$(".pop2").hide();
						} else {
							$(".hint2").css("visibility", "visible");
							$(".hint2").html(result.message);
							changeGraphCode();
						}
					},
					error: function() {
						$(".ensure2").attr("disabled", false);
						$(".ensure2").css("background-color", "#ff8f2b");
					}
				});
			}
		});

		//下载app
		$('.ensure3').click(function() {
			window.location.href = "download/guide_" + alias + ".html?origin=" + origin_id;
		});

		//关闭弹窗
		$(".close").click(function() {
			old_phone = $(".phonenumber").html();
			$(".mask,.newpop").css({
				"display": "none"
			});
		});

		//焦点事件
		$("input").focus(function() {
			$(".hint1,.hint2").css("visibility", "hidden");
		});

		$(".text1").focus(function() {
			push(alias, "手机号", clientType, origin_id);
		});

		//图形验证码
		function changeGraphCode() {
			$.ajax({
				type: "post",
				url: domain + "web/graph_code",
				dataType: "json",
				data: {},
				success: function(data) {
					if(data.status == 2000) {
						uuid = data.data.uuid;
						$("#imgcode").attr("src", data.data.graph_code);
					}
				}
			});
		};

		//轮播
		var timer = setTimeout(function() {
			$(".txtMarquee-top").slide({
				mainCell: ".bd ul",
				autoPlay: true,
				effect: "topLoop",
				vis: 1,
				interTime: 2000,
				mouseOverStop: false
			});
		}, 500);
	</script>

</html>